import requests

if __name__ == '__main__':

    url = 'http://127.0.0.1:6688'
    # 登录
    usr = { 'account':'admin',
            'password':'admin',
            'code':'1234'
        }
    header = {'X-Requested-With':'XMLHttpRequest'}
    login =requests.post(url+'/admin/account/login.html',data=usr,headers=header)
    print(login.text)
    header['cookie'] = login.headers['Set-Cookie']


    # 添加品牌
    pp= {'name':'华为',
    'initial':'H',
    'image':'uploads/images/2022021111014949ae08187.png',
    'sort':5,
    'is_show':1,
    'remark':'中华有为'
    }

    addpp = requests.post(url+'/admin/goods_brand/add.html',data=pp,headers=header)
    print(addpp.text)